#include "StdAfx.h"
#include "Graphics.h"

CGraphics::CGraphics(u16 *data, int width, int height)
{
	m_data = data;
	m_width = width;
	m_height = height;
}

CGraphics::~CGraphics()
{
}
	
	
void CGraphics::fillRect(int x, int y, int width, int height)
{
	for (int i=0;i<height;i++)
	{		
		u16 *p = m_data + (i+y)*m_width + x;
		
//		for (int j = 0; j<width; j++)
//			p[j] = m_color;
		MI_CpuFill16(p, m_color, width*2);
	}
}

void CGraphics::putPixel(int x, int y)
{
	m_data[y*m_width + x] = m_color;
}

void CGraphics::putPixel(int x, int y, u16 color)
{
	m_data[y*m_width + x] = color;
}

void CGraphics::putPixel(int x, int y, u8 r, u8 g, u8 b)
{
	putPixel(x,y,COLOR_RGBTO555(r,g,b));
}

u16 CGraphics::getPixel(int x, int y)
{
	return m_data[y*m_width + x];
}
